package com.itheima.web;

import com.itheima.entity.Result;
import com.itheima.pojo.Setmeal;
import com.itheima.service.SetmealService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/setmeal")
public class setmealController {

    @Reference
    private SetmealService setmealService;

    @RequestMapping("/findAll")
    public List<Setmeal> findAll(){
        return setmealService.findAll();
    }

    @GetMapping("/findSetmealDetail/{setmealId}")
    public Result findSetmealDetail(@PathVariable("setmealId") Long setmealId){
        return new Result(setmealService.findSetmealDetail(setmealId));
    }

    @GetMapping("/findSetmeal/{setmealId}")
    public Result findSetmeal(@PathVariable("setmealId") Long setmealId){
        return new Result(setmealService.getById(setmealId));
    }
}
